package com.fh.util;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class JsonStringUtil {
	  public static JSONArray getParameterswebSoocket(String messgae)
	            throws UnsupportedEncodingException, IOException {
	        String acceptjson = messgae;
	        JSONArray jo = null;
	        if (acceptjson != "") {
	            jo = JSONArray.fromObject(acceptjson);
	        }
	        return jo;
	    }
	  
	  
	  public static JSONObject getJSONObjectwebSoocket(String messgae)
	            throws UnsupportedEncodingException, IOException {
	        String acceptjson = messgae;
	        JSONObject jo = null;
	        if (acceptjson != "") {
	            jo = JSONObject.fromObject(acceptjson);
	        }
	        return jo;
	    }
	  
	  
	  public static JSONObject getJSONObjectwebSoocket(Map messgae)
	             {
		     Map acceptjson = messgae;
	        JSONObject jo = null;
	        if (null !=acceptjson) {
	            jo = JSONObject.fromObject(acceptjson);
	        }
	        return jo;
	    }
	  
	  public static Object getJSONResult(Object code,Object msg,Object data) throws UnsupportedEncodingException{
		    JSONObject js = new JSONObject();
		    js.put("code", code.toString());
		    js.put("msg", msg.toString());
		    js.put("data", data.toString());
	        return js.toString();
	  }
	  
	  
	  
}
